﻿package com.sz.common;

import java.lang.reflect.Method;

public class SZUtility {
	
	static public String toString(Object obj) {
		if(obj != null) return obj.toString();
		else return "";
	}
	
	@SuppressWarnings("unchecked")
	static public String toString_TimeStamp(Object obj) {
		try {
			if (obj.getClass().getName().equals("oracle.sql.TIMESTAMP")) {
				Class clz = obj.getClass();
				Method m = clz.getMethod("timestampValue");
				java.sql.Timestamp t = (java.sql.Timestamp) m.invoke(obj);
				return t.toString();
			} else {
				return obj.toString();
			}
		} catch (Exception e) {
			return "";
		}
	}
}
